package com.huawei.codearts.tools.utils;


import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 * .properties 扩展名的配置文件解析
 */
public class SettingUtils {
    private static final Properties properties = new Properties();

    static {
        try {
            InputStream inputStream = new FileInputStream("./src/main/resources/application.properties");
            properties.load(inputStream);
            inputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static String getProperty(String key) {
        return properties.getProperty(key);
    }

    public static void setProperty() {
//        String value = SettingManager.getProperty("database.url");
//        String configValue = value;
    }

//    public static void main(String[] args) {
//        String dbUrl = SettingManager.getProperty("database.url");
//        String dbUser = SettingManager.getProperty("database.user");
//        String dbPassword = SettingManager.getProperty("database.password");
//
//        System.out.println("Database URL: " + dbUrl);
//        System.out.println("Database User: " + dbUser);
//        System.out.println("Database Password: " + dbPassword);
//
//        String commandLineArgs = System.getProperty("spring.config.name");
//        System.out.println(commandLineArgs);
//    }
}
